package us.pinguo.imageloader;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;

import com.nostra13.universalimageloader.core.assist.ImageScaleType;

import butterknife.ButterKnife;
import butterknife.InjectView;
import us.pinguo.imageloader.demo.R;
import us.pinguo.loader.PinguoImageLoader;
import us.pinguo.loader.view.PinguoImageView;

public class MainActivity extends Activity {

    private String url = "http://t12.baidu.com/it/u=4095575894,102452705&fm=32&s=A98AA55F526172A6F6A058E50300A060&w=623&h=799&img.JPEG";

    @InjectView(R.id.iv1)
    public ImageView mIv1;
    @InjectView(R.id.iv2)
    public ImageView mIv2;
    @InjectView(R.id.iv3)
    public ImageView mIv3;
    @InjectView(R.id.iv4)
    public ImageView mIv4;
    @InjectView(R.id.iv5)
    public ImageView mIv5;
    @InjectView(R.id.iv6)
    public ImageView mIv6;
    @InjectView(R.id.iv7)
    public ImageView mIv7;
    @InjectView(R.id.iv8)
    public ImageView mIv8;
    @InjectView(R.id.iv9)
    public ImageView mIv9;
    @InjectView(R.id.iv10)
    public ImageView mIv10;
    @InjectView(R.id.iv11)
    public ImageView mIv11;
    @InjectView(R.id.iv12)
    public ImageView mIv12;
    @InjectView(R.id.iv13)
    public ImageView mIv13;
    @InjectView(R.id.iv14)
    public ImageView mIv14;
    @InjectView(R.id.switcher)
    public PinguoImageView mIs;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        ButterKnife.inject(this);
        //示例0 、背景淡出，图片淡入
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setDisplayType(PinguoImageLoader.DISPLAY_DEFAULT)
                .into(mIs);
        /* 示例一、普通加载图片*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setDisplayType(PinguoImageLoader.DISPLAY_DEFAULT)
                .into(mIv1);
        /* 示例二、渐变显示*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setDisplayType(PinguoImageLoader.DISPLAY_FADE_IN)
                .setFadeInTime(1000)
                .into(mIv2);
        /* 示例三、圆角矩形显示*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setRoundRadius(30)
                .setDisplayType(PinguoImageLoader.DISPLAY_ROUND)
                .into(mIv3);
        /* 示例四、圆角矩形淡入显示*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setRoundRadius(30)
                .setDisplayType(PinguoImageLoader.DISPLAY_ROUND_FADE_IN)
                .setFadeInTime(1000)
                .into(mIv4);
        /* 示例五、圆角矩形LOMO显示*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setRoundRadius(30)
                .setDisplayType(PinguoImageLoader.DISPLAY_ROUND_VIGNETTE)
                .into(mIv5);
        /* 示例六、圆角矩形LOMO淡入显示*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setRoundRadius(30)
                .setDisplayType(PinguoImageLoader.DISPLAY_ROUND_VIGNETTE_FADE_IN)
                .setFadeInTime(1000)
                .into(mIv6);
        /* 示例七、圆形显示*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setDisplayType(PinguoImageLoader.DISPLAY_CIRCLE)
                .into(mIv7);
        /* 示例八、圆形淡入显示*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setDisplayType(PinguoImageLoader.DISPLAY_CIRCLE_FADE_IN)
                .setFadeInTime(1000)
                .into(mIv8);

        /* 示例九、带环的圆形图片*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setStrokeWidth(5.f)
                .setColor(0xff00ff00)
                .setRingPadding(3.f)
                .setDisplayType(PinguoImageLoader.DISPLAY_CIRCLE_RING)
                .into(mIv9);
        /* 示例十、模糊图片显示*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setBlurDepth(20)
                .setDisplayType(PinguoImageLoader.DISPLAY_BLUR)
                .into(mIv10);
        /* 示例十一、模糊图片显示*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setBlurDepth(20)
                .setFadeInTime(1000)
                .setDisplayType(PinguoImageLoader.DISPLAY_BLUR_FADE_IN)
                .into(mIv11);
        /* 示例十二、模糊图片显示*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setBlurDepth(20)
                .setRoundRadius(20)
                .setDisplayType(PinguoImageLoader.DISPLAY_ROUND_BLUR)
                .into(mIv12);
        /* 示例十三、模糊图片显示*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setBlurDepth(20)
                .setRoundRadius(20)
                .setDisplayType(PinguoImageLoader.DISPLAY_ROUND_BLUR_VIGNETTE)
                .into(mIv13);
//        /* 示例十四、模糊图片显示*/
        PinguoImageLoader.create(url)
                .setImageScaleType(ImageScaleType.EXACTLY)
                .setDefaultRes(R.drawable.ic_launcher)
                .setFailRes(R.drawable.ic_launcher)
                .setEmptyRes(R.drawable.ic_launcher)
                .setBlurDepth(20)
                .setDisplayType(PinguoImageLoader.DISPLAY_CIRCLE_BLUR)
                .into(mIv14);
    }


}
